package org.jeecg.modules.gather.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.gather.model.query.WebCaptureQuery;
import org.jeecg.modules.gather.service.WebCaptureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/webCapture/task")
@Api(tags = "网页采集任务")
public class WebCaptureController {
    private final WebCaptureService webCaptureService;

    @Autowired
    public WebCaptureController(WebCaptureService webCaptureService) {
        this.webCaptureService = webCaptureService;
    }

    @PostMapping("/startWebCaptureTask")
    @ApiOperation(value = "开始采集任务")
    public Result<String> startCollectMetaTask(@RequestBody @Validated WebCaptureQuery webCaptureQuery) {
        return webCaptureService.startWebCaptureTask(webCaptureQuery);
    }
}
